#ifndef __LOGGER_H__
  #define __LOGGER_H__

#include <string>
#include <sstream>
#include <fstream>
#include <cstring>

using namespace std;

//! Logger implementation

/*!
A simple implementation for logger. A logger can write strings to output files in a simple and fast way.

Implementation date: 2006

Usage:

\code
logger::log("file_name.txt", "hello"); // hello will be appended to the file
logger::log("file_name.txt", "hello", true, false); // file content will be cleared first

logger::log("file_name.txt", 2008); // also integers are supported
\endcode
*/

class logger {
private:
  static void write_to_file(const string &file_name, const string &message, bool line_feed, bool append);

public:
  //! write the given string into the given file
  static void log(const string &file_name, const string &message, bool line_feed = true, bool append = true);

  //! write the given integer into the given file
  static void log(const string &file_name, int number, bool line_feed = true, bool append = true);

  //! write the given character into the given file
  static void log(const string &file_name, char c, bool line_feed = true, bool append = true);
}; // class logger

#endif
